using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


/// <summary>
/// The EmployeeDesignationTableManager class is responsible for managing BO.EmployeeDesignationTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class EmployeeDesignationTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all EmployeeDesignationTable objects in the database.
/// </summary>
/// <returns>A list with all EmployeeDesignationTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static EmployeeDesignationTableList GetList(){
return EmployeeDesignationTableDB.GetList();
}

[DataObjectMethod(DataObjectMethodType.Select, true)]
public static EmployeeDesignationTableList GetList(int UserAccountKey)
{
    return EmployeeDesignationTableDB.GetListByUserAccountKey(UserAccountKey);
}

/// <summary>
/// Gets a single EmployeeDesignationTable from the database without its data.
/// </summary>
/// <param name="employeeDesignationKey">The EmployeeDesignationKey of the EmployeeDesignationTable in the database.</param>
/// <returns>A EmployeeDesignationTable object when the EmployeeDesignationKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EmployeeDesignationTable GetItem(int employeeDesignationKey){
return GetItem(employeeDesignationKey, false);
}

/// <summary>
/// Gets a single EmployeeDesignationTable from the database.
/// </summary>
/// <param name="employeeDesignationKey">The EmployeeDesignationKey of the EmployeeDesignationTable in the database.</param>
/// <param name="getEmployeeDesignationTableRecords">Determines whether to load all associated EmployeeDesignationTable records as well.</param>
/// <returns>
/// A EmployeeDesignationTable object when the EmployeeDesignationKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EmployeeDesignationTable GetItem(int employeeDesignationKey, bool getEmployeeDesignationTableRecords){
EmployeeDesignationTable myEmployeeDesignationTable = EmployeeDesignationTableDB.GetItem(employeeDesignationKey);
return myEmployeeDesignationTable;
}

public static EmployeeDesignationTable GetActiveDesignationItem(int UserAccountKey)
{
    EmployeeDesignationTable myTeacherDesignationTable = EmployeeDesignationTableDB.GetActiveItem(UserAccountKey);
    return myTeacherDesignationTable;
}

/// <summary>
/// Saves a EmployeeDesignationTable in the database.
/// </summary>
/// <param name="myEmployeeDesignationTable">The EmployeeDesignationTable instance to save.</param>
/// <returns>The new EmployeeDesignationKey if the EmployeeDesignationTable is new in the database or the existing EmployeeDesignationKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(EmployeeDesignationTable myEmployeeDesignationTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int employeeDesignationTableEmployeeDesignationKey = EmployeeDesignationTableDB.Save(myEmployeeDesignationTable);

//  Assign the EmployeeDesignationTable its new (or existing EmployeeDesignationKey).
myEmployeeDesignationTable.EmployeeDesignationKey = employeeDesignationTableEmployeeDesignationKey;

myTransactionScope.Complete();

return employeeDesignationTableEmployeeDesignationKey;
}
}

/// <summary>
/// Deletes a EmployeeDesignationTable from the database.
/// </summary>
/// <param name="myEmployeeDesignationTable">The EmployeeDesignationTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(EmployeeDesignationTable myEmployeeDesignationTable){
return EmployeeDesignationTableDB.Delete(myEmployeeDesignationTable.EmployeeDesignationKey);
}

[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(int EmployeeDesignationKey)
{
    return EmployeeDesignationTableDB.Delete(EmployeeDesignationKey);
}

#endregion

}

